//============================================================================
// Name        : cpp_dir.cpp
// Author      : darkflash
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <dirent.h>
#include <stdio.h>
using namespace std;

void print_dir(string path){
	DIR *dir;
	struct dirent *ent;
	if ((dir = opendir (path.c_str())) != NULL) {
	  /* print all the files and directories within directory */
	  while ((ent = readdir (dir)) != NULL) {
		printf ("%s\n", ent->d_name);
	  }
	  closedir (dir);
	} else {
	  /* could not open directory */
	  perror ("");
	}
}

int main() {
	string input;

	cout << "input path: ";
	cin >> input;

	print_dir(input);
	return 0;
}
